package com.util;

import java.beans.PropertyEditorSupport;

public class StringEditor extends PropertyEditorSupport {
    @Override
    public String getAsText() {
        return getValue().toString();
    }

    @Override
    public void setAsText(String text) throws IllegalArgumentException {
        if(text!=null&&!text.equals("")){
            text=text.replaceAll("\\\\\"","\"");
            text=text.replaceAll("\\\\\'","\'");
            text=text.replaceAll("\"","\\\\\"");
            text=text.replaceAll("\'","\\\\\'");
        }
        setValue(text);
    }

}
